package com.ruoyi.system.enums;

/**
 * 出库状态
 */
public enum WmsOutboundStatus {
    // 定义三个枚举常量
    SHIPPED("已出库", "1"),
    PENDING("待出库", "2"),
    INVALID("作废", "3");

    // 枚举属性
    private final String description;
    private final String code;

    // 构造函数
    WmsOutboundStatus(String description, String code) {
        this.description = description;
        this.code = code;
    }

    // 获取描述
    public String getDescription() {
        return description;
    }

    // 获取状态码
    public String getCode() {
        return code;
    }

    // 通过code获取枚举实例
    public static WmsOutboundStatus getByCode(String code) {
        for (WmsOutboundStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }

    // 通过description获取枚举实例
    public static WmsOutboundStatus getByDescription(String description) {
        for (WmsOutboundStatus status : values()) {
            if (status.description.equals(description)) {
                return status;
            }
        }
        return null;
    }
}